package yz.cp.back.s.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import yz.cp.back.s.entity.SysUser;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author jobob
 * @since 2019-04-03
 */
@CacheConfig(cacheNames = "user")
public interface ISysUserService extends IService<SysUser> {
    /**
     * 通过用户名获取用户
     * @param username
     * @return
     */
    @Cacheable(key = "#username")
    SysUser findByUsername(String username);

    /**
     * 通过手机获取用户
     * @param mobile
     * @return
     */
    SysUser findByMobile(String mobile);

    /**
     * 通过邮件和状态获取用户
     * @param email
     * @return
     */
    SysUser findByEmail(String email);


    /**
     * 通过部门id获取
     * @param departmentId
     * @return
     */
    List<SysUser> findByDepartmentId(String departmentId);

    /**
     * 通过用户名模糊搜索
     * @param username
     * @param status
     * @return
     */
    List<SysUser> findByUsernameLikeAndStatus(String username, Integer status);

}
